package com.nb.serv;

import java.sql.Connection;
import java.sql.DriverManager;


public class JDBCManager {
	private static JDBCManager jdbcManager = null;
	private static String driverClss = "";
	private static String url = "";
	private static String username = "";
	private static String password = "";

	public static JDBCManager getInstance() {
		if (null == jdbcManager) {
			jdbcManager = new JDBCManager();
			try {
				JDBCManager.driverClss=Config.DRIVER;
				JDBCManager.username=Config.USER_NAME;
				JDBCManager.password=Config.PASSWORD;
				JDBCManager.url=Config.URL;
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return jdbcManager;
	}

	public Connection getConnetion() {
		try {
			Class.forName(driverClss);
			Connection connection = DriverManager.getConnection(url, username,password);
			return connection;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	public static void main(String[] args) {
		JDBCManager.getInstance().getConnetion();
	}
}
